package com.njupt.webapp.tags;

import net.sf.ehcache.Cache;

import com.njupt.dao.BaseDao;

public class HqlBaseTag extends ApplicationContextTag{

	protected String scope;
	/** 有时一个项目可能会同时操作多个数据库 */
	protected String baseDaoId = "baseDao";
	protected String hql;
	protected boolean useCache = false;//是否使用cache
	protected String cacheName = "sqlModelsCache";//默认使用这个cache
	
	public String getHql() {
		return hql;
	}
	public void setHql(String hql) {
		this.hql = hql;
	}
	
	public String getBaseDaoId() {
		return baseDaoId;
	}
	public void setBaseDaoId(String baseDaoId) {
		this.baseDaoId = baseDaoId;
	}
	
	
	public String getScope() {
		return scope;
	}
	public void setScope(String scope) {
		this.scope = scope;
	}
	protected BaseDao getBaseDao(){
		return (BaseDao) this.getBean(baseDaoId);
	}

	public boolean isUseCache() {
		return useCache;
	}
	public void setUseCache(boolean useCache) {
		this.useCache = useCache;
	}
	protected Cache getCache(){
		return (Cache)this.getBean(cacheName);
	}
}
